//
//  XJButtonGroup.m
//  TabelibleScrollerViewSample
//
//  Created by chenxinju on 16/6/19.
//  Copyright © 2016年 Innovation. All rights reserved.
//

#import "XJButtonGroup.h"

static const CGFloat kMargin = 20;
static const CGFloat kBUttonW = 44;
@implementation XJButtonGroup

- (instancetype)initWithButtons:(NSArray *)buttons {
    if (self = [super init]) {
        _buttons = buttons;
        
        [self setupButtons];
    }

    return self;
}


- (instancetype)init {
 
    return nil;
}

- (void)setupButtons {
    for (NSInteger i = 0; i<_buttons.count; i++) {
        
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake((kBUttonW + kMargin)*i, 0, kBUttonW, kBUttonW);
        [button setImage:[UIImage imageNamed:_buttons[i]] forState:UIControlStateNormal];
        [self addSubview:button];
        
    }
}

@end
